home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / cmds / gdb-4.5 / dist / libiberty / vsprintf.c < prev   
Encoding:
C/C++ Source or Header  |  1991-11-03  |  1.4 KB  |  48 lines

  1. /* Simple implementation of vsprintf for systems without it.
  2.    Highly system-dependent, but should work on most "traditional"
  3.    implementations of stdio; newer ones should already have vsprintf.
  4.    Written by Per Bothner of Cygnus Support.
  5.    Based on libg++'s "form" (written by Doug Lea; dl@rocky.oswego.edu).
  6.    Copyright (C) 1991 Free Software Foundation, Inc.
  7.  
  8. This program is free software; you can redistribute it and/or modify
  9. it under the terms of the GNU General Public License as published by
  10. the Free Software Foundation; either version 2 of the License, or
  11. (at your option) any later version.
  12.  
  13. This program is distributed in the hope that it will be useful,
  14. but WITHOUT ANY WARRANTY; without even the implied warranty of
  15. MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
  16. GNU General Public License for more details.
  17.  
  18. You should have received a copy of the GNU General Public License
  19. along with this program; if not, write to the Free Software
  20. Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.  */
  21.  
  22. #include <varargs.h>
  23. #include <stdio.h>
  24. #undef vsprintf
  25.  
  26. int
  27. vsprintf (buf, format, ap)
  28.      char *buf;
  29.      char *format;
  30.      va_list ap;
  31. {
  32.   FILE b;
  33.   int ret;
  34. #ifdef VMS
  35.   b->_flag = _IOWRT|_IOSTRG;
  36.   b->_ptr = buf;
  37.   b->_cnt = 12000;
  38. #else
  39.   b._flag = _IOWRT|_IOSTRG;
  40.   b._ptr = buf;
  41.   b._cnt = 12000;
  42. #endif
  43.   ret = _doprnt(format, ap, &b);
  44.   putc('\0', &b);
  45.   return ret;
  46.  
  47. }
  48.